<template>
  <div>
    <confirm :show.sync="show" confirm-text="确认" cancel-text="取消" title="注销提示" @on-cancel="onCancel" @on-confirm="onConfirm" @on-show="onShow" @on-hide="onHide">
      <p style="text-align:center;">你确定退出登录吗？</p>
    </confirm>
  </div>
</template>

<script>
import { Confirm } from './../../../components'
var LocalStorageUtil = require('./../../../commons/js/LocalStorageUtil.js')
var CartUtil = require('./../../../commons/js/Cart')
export default {
  name: "loginoutConfirm",
  components: {
    Confirm
  },
  props: {
    show: Boolean,
    status: Boolean
  },
  methods: {
    onCancel () {
      console.log('on cancel')
      this.show = false
      this.status = true
      var data = {
        show: this.show,
        loginStatus: this.status
      }
      this.$emit('message', data)
    },
    onConfirm () {
      console.log('on confirm')
      LocalStorageUtil.setItem("User", "")
      LocalStorageUtil.setItem("Address", "")
      CartUtil.clearCartStorage();
      this.show = false
      this.status = false
      var data = {
        show: this.show,
        loginStatus: this.status
      }
      this.$emit('message', data)
    },
    onHide () {
      console.log("hide")
    },
    onShow () {
      console.log("show")
    }
  }
}
</script>
